–
Postfixの設定変更
Postfixの設定ファイルのほとんどが「/etc/postfix」配下に大半が存在しております。
1. 編集を行なう前にバックアップを取りましょう。
[root@mail ~]# cp -p /etc/postfix/main.cf /etc/postfix/main.cf.ORG
2. コピーで作成したバックアップを確認します。
[root@mail ~]# ls -l /etc/postfix/main.cf* -rw-r--r-- 1 root root 27071 May 13 09:09 /etc/postfix/main.cf -rw-r--r-- 1 root root 17981 Apr 14 07:59 /etc/postfix/main.cf.default -rw-r--r-- 1 root root 26737 Apr 14 07:59 /etc/postfix/main.cf.ORG [root@mail ~]#
3. main.cfを編集します。
[root@mail ~]# vi /etc/postfix/main.cf ~省略~ # INTERNET HOST AND DOMAIN NAMES # # The myhostname parameter specifies the internet hostname of this # mail system. The default is to use the fully-qualified domain name # from gethostname(). $myhostname is used as a default value for many # other configuration parameters. # #myhostname = host.domain.tld #myhostname = virtual.domain.tld myhostname = mail.trippyboy.com ←サーバのホスト名を設定 # The mydomain parameter specifies the local internet domain name. # The default is to use $myhostname minus the first component. # $mydomain is used as a default value for many other configuration # parameters. # #mydomain = domain.tld mydomain = trippyboy.com ←ドメイン名を指定 # SENDING MAIL # # The myorigin parameter specifies the domain that locally-posted # mail appears to come from. The default is to append $myhostname, # which is fine for small sites. If you run a domain with multiple # machines, you should (1) change this to $mydomain and (2) set up # a domain-wide alias database that aliases each user to # user@that.users.mailhost. # # For the sake of consistency between sender and recipient addresses, # myorigin also specifies the default domain name that is appended # to recipient addresses that have no @domain part. # #myorigin = $myhostname #myorigin = $mydomain myorigin = $mydomain ←追加 # RECEIVING MAIL # The inet_interfaces parameter specifies the network interface # addresses that this mail system receives mail on. By default, # the software claims all active interfaces on the machine. The # parameter also controls delivery of mail to user@[ip.address]. # # See also the proxy_interfaces parameter, for network addresses that # are forwarded to us via a proxy or network address translator. # # Note: you need to stop/start Postfix when this parameter changes. # #inet_interfaces = all #inet_interfaces = $myhostname #inet_interfaces = $myhostname, localhost #inet_interfaces = localhost ←編集 inet_interfaces = all ←追加 ~省略~ # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS". # mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain ←追加 #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, # mail.$mydomain, www.$mydomain, ftp.$mydomain ~省略~ # DELIVERY TO MAILBOX # # The home_mailbox parameter specifies the optional pathname of a # mailbox file relative to a user's home directory. The default # mailbox file is /var/spool/mail/user or /var/mail/user. Specify # "Maildir/" for qmail-style delivery (the / is required). # #home_mailbox = Mailbox #home_mailbox = Maildir/ home_mailbox = Maildir/ ←追加 ~省略~ # SHOW SOFTWARE VERSION OR NOT # # The smtpd_banner parameter specifies the text that follows the 220 # code in the SMTP server's greeting banner. Some people like to see # the mail version advertised. By default, Postfix shows no version. # # You MUST specify $myhostname at the start of the text. That is an # RFC requirement. Postfix itself does not care. # #smtpd_banner = $myhostname ESMTP $mail_name #smtpd_banner = $myhostname ESMTP $mail_name ($mail_version) smtpd_banner = $myhostname ESMTP unknown ←追加 ~省略~ # readme_directory: The location of the Postfix README files. # readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES # SMTP Auth ←ファイルの一番下に追加 smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
4. 「diff」コマンドを用いてバックアップとの差分を確認します。
ファイルの変更点とその意味を網羅しておこう。今回は見やすく「-c」を使いました。
[root@mail ~]# diff -c /etc/postfix/main.cf /etc/postfix/main.cf.ORG *** /etc/postfix/main.cf 2011-05-13 10:43:38.000000000 +0900 --- /etc/postfix/main.cf.ORG 2011-04-14 07:59:27.000000000 +0900 *************** *** 68,74 **** # #myhostname = host.domain.tld #myhostname = virtual.domain.tld - myhostname = mail.trippyboy.com サーバのホスト名を指定 # The mydomain parameter specifies the local internet domain name. # The default is to use $myhostname minus the first component. --- 68,73 ---- *************** *** 76,82 **** # parameters. # #mydomain = domain.tld - mydomain = trippyboy.com 使用ドメインを指定 # SENDING MAIL # --- 75,80 ---- *************** *** 93,99 **** # #myorigin = $myhostname #myorigin = $mydomain - myorigin = $mydomain 送信元メールアドレスのドメイン指定 # RECEIVING MAIL --- 91,96 ---- *************** *** 110,117 ****変更後 #inet_interfaces = all #inet_interfaces = $myhostname #inet_interfaces = $myhostname, localhost ! #inet_interfaces = localhost ! inet_interfaces = all 「localhost」でなくて何処からでも接続可能に変更 # The proxy_interfaces parameter specifies the network interface # addresses that this mail system receives mail on by way of a --- 107,113 ----変更前 #inet_interfaces = all #inet_interfaces = $myhostname #inet_interfaces = $myhostname, localhost ! inet_interfaces = localhost # The proxy_interfaces parameter specifies the network interface # addresses that this mail system receives mail on by way of a *************** *** 156,162 ****変更後 # # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS". # 何処宛のメールを処理するサーバか宣言するところにドメインを追加。 ! mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, # mail.$mydomain, www.$mydomain, ftp.$mydomain --- 152,158 ----変更前 # # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS". # ! mydestination = $myhostname, localhost.$mydomain, localhost #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, # mail.$mydomain, www.$mydomain, ftp.$mydomain *************** *** 412,418 **** # #home_mailbox = Mailbox #home_mailbox = Maildir/ - home_mailbox = Maildir/ メールボックスの場所設定 # The mail_spool_directory parameter specifies the directory where # UNIX-style mailboxes are kept. The default setting depends on the --- 408,413 ---- *************** *** 564,570 **** # #smtpd_banner = $myhostname ESMTP $mail_name #smtpd_banner = $myhostname ESMTP $mail_name ($mail_version) - smtpd_banner = $myhostname ESMTP unknown サーバのバージョンを隠す設定 # PARALLEL DELIVERY TO THE SAME DESTINATION # --- 559,564 ---- *************** *** 671,682 **** # readme_directory: The location of the Postfix README files. # readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES - - # SMTP Auth - smtpd_sasl_auth_enable = yes SMTP認証を有効化 - smtpd_sasl_local_domain = $myhostname Relayを許可するドメイン設定 - smtpd_recipient_restrictions = 送信時の制限(下に続く) - permit_mynetworks 自分の環境からは許可 - permit_sasl_authenticated SMTP認証済みは許可 - reject_unauth_destination SMTP認証失敗は拒否 - --- 665,667 ---- [root@mail ~]#
以上で設定変更が完了しました。
次のページ「Postfixの設定変更その2」
コメント